package com.nbsaas.sample.user.rest.convert;

import com.nbsaas.sample.entity.user.UserRoleCatalog;
import com.nbsaas.sample.user.api.domain.request.UserRoleCatalogDataRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.sample.entity.user.UserRoleCatalog;

/**
* 请求对象转换成实体对象
*/

public class UserRoleCatalogEntityConvert  implements Converter<UserRoleCatalog, UserRoleCatalogDataRequest> {
@Override
public UserRoleCatalog convert(UserRoleCatalogDataRequest source) {
UserRoleCatalog result = new UserRoleCatalog();
BeanDataUtils.copyProperties(source, result);
            if(source.getParent()!=null){
            UserRoleCatalog parent =new UserRoleCatalog();
            parent.setId(source.getParent());
            result.setParent(parent);
            }
return result;
}
}

